package oop3.src.polymorohic_demo;

public class Computer {
    private String name;

    public Computer() {
    }

    public Computer(String name) {
        this.name = name;
    }

    public void installUSB(polymorohic_demo.USB usb){
        usb.connect();

        if(usb instanceof Keyboard){
            Keyboard keyboard = (Keyboard) usb;
            keyboard.kayDown();
        }
        else if(usb instanceof polymorohic_demo.Mouse){
            polymorohic_demo.Mouse m = (polymorohic_demo.Mouse) usb;
            m.click();
        }
        usb.unconnect();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
